<html>
<head>
<!-- Copyright (c) GoAhead Software Inc., 1995-2010. All Rights Reserved. -->
<title>websExpand -- GoAhead WebServer API</title>
<link rel="stylesheet" href="../../../style/doc.css" type="text/css">
</head>

<body>
<table class=apitable> <tr><td>
<TABLE border=0 width=100% cellspacing=0 cellpadding=0 CLASS="apiTitle"> <TR> 
<td class="titleLeft" align=left width="33%">websExpand</TD><td class="titleCenter" align=center width="33%"><b> 
GoAhead WebServer API</b></TD><td class="titleRight" align=right width="33%"><B> 
GoAhead EMF</B></TD></TR> </TABLE><HR> <h2>Synopsis</h2><p>Expand dollar variables 
in a string.</p><h2>Prototype</h2><pre> #include &quot;webs.h&quot; 

 char_t *<b>websExpand</b>
     (webs_t wp, char_t *buf, char_t *string, int bufsize); </pre><h2>Parameters</h2><table width=100% BORDER="0" CELLPADDING="0" CELLSPACING="0"> 
<TR> <TD VALIGN="TOP" WIDTH="5%">wp <TD WIDTH="95%"> Web server connection handle 
<TR> <TD VALIGN="TOP" WIDTH="5%">buf <TD WIDTH="95%">Output buffer <TR> <TD VALIGN="TOP" WIDTH="5%">string 
<TD WIDTH="95%"> Input string<tr> <td cellpadding = 20 VALIGN="TOP" WIDTH="5%">len</td><td cellpadding = 20 WIDTH="95%"> 
Size of output buffer</td></tr></table><h2>Description</h2><P>The websExpand procedure 
can be used to expand all dollar variables. These include all the standard CGI 
variables, extended GoAhead WebServer variables, and all current per request variables. 
In addition to the standard set below, all request header variables are stored 
as &quot;HTTP_name&quot; where name is the request header keyword mapped to lower 
case. If a particular dollar variable is not found, the original text for that 
variable is unchanged. </P><P>If the <EM>buffer</EM> is NULL, the expanded string 
is returned in a dynamically allocated buffer. Use <STRONG>bfree</STRONG> to free 
the buffer when you are finished. </P><P> The standard variable set includes: 
</P><table width="100%" border="1" CELLPADDING="0" CELLSPACING="0"> <tr><td>COMPANY</td><td>Defined 
company name</td></tr> <tr><td>CONTENT_LENGTH</td><td>Length of posted content</td></tr> 
<tr><td>DBNAME</td><td>Primary database name &quot;primary&quot;</td></tr> <tr><td>DESCRIPTION</td><td>Product 
description</td></tr> <tr><td>D_OS</td><td>Operating system name</td></tr> <tr><td>D_PROD</td><td>Home 
directory for the product</td></tr> <tr><td>D_SOLUTION</td><td>Home directory 
for solution packs</td></tr> <tr><td>GATEWAY_INTERFACE</td><td>Version of this 
gateway interface</td></tr> <TR> <TD>HTTP_AUTHORIZATION <TD>Password supplied 
by the browser <TR> <TD>HTTP_name <TD>Where name is any key name in the browser 
request <tr><td>OS</td><td>Operating system</td></tr> <tr><td>PATH_INFO</td><td>URL 
path information after /form</td></tr> <tr><td>PATH_TRANSLATED</td><td>File system 
path name for URL document</td></tr> <tr><td>PRODUCT</td><td>Product name</td></tr> 
<tr><td>QUERY_STRING</td><td>Complete query string</td></tr> <tr><td>REMOTE_ADDR</td><td>Requesting 
browser's IP address</td></tr> <tr><td>REMOTE_HOST</td><td>Requesting browser's 
host name</td></tr> <tr><td>REQUEST_METHOD</td><td>Request operation type</td></tr> 
<tr><td>SERVER_HOST</td><td>Host name for this Web server</td></tr> <tr><td>SERVER_PORT</td><td>TCP/IP 
port used by this Web server</td></tr> <tr><td>SERVER_URL</td><td>URL to address 
the home page for this Web server</td></tr> <tr><td>VERSION</td><td>Version number 
(n.n) for this product</td></tr> <tr><td>VERSION_FULL</td><td>Full version number 
(n.n.n)</td></tr> </table><h2>Return Value</h2><p> Returns the <i>buffer</i> supplied 
or dynamically allocated buffer if <i>buffer</i> was NULL. Returns NULL on errors.</p><h2>Example</h2><pre> 
websExpand(wp, NULL, &quot;$COMPANY $SERVER_PORT&quot;, -1); </pre><h2>Stability 
Classification</h2><p>Stable.</p><h2>See Also</h2><p><A href="../basicapi/bfree.htm">bfree</A></p></td></tr></table>
</body>
</html>
